/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ueb14.uebTree;

/**
 *
 * @author adier
 */
public class Professor {
    private String name         = null;
    private String vorlesung    = null;
    private double salary       = 0;
    
    public Professor(String name) throws ProfessorException{
        setName(name);
    }
    
    public Professor(String name, String vorlesung, double gehalt) throws ProfessorException{
        setName(name);
        setVorlesung(vorlesung);
        setSalary(salary);
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public String getVorlesung() {
        return vorlesung;
    }

    public void setName(String name) throws ProfessorException {
        if(name.equals(null) || name.trim().equalsIgnoreCase(""))
        {
            throw new ProfessorException("professor must have a name");
        }
        this.name = name;
    }

    public void setSalary(double salary) throws ProfessorException {
        if( salary < 0 )
        {
            throw new ProfessorException("salary can not be less then 0");
        }
            this.salary = salary;
    }

    public void setVorlesung(String vorlesung) {
        this.vorlesung = vorlesung;
    }
    
    public String toString() {
      return name;
  }
    
}
